

//井字棋，1为自己，-1为对手，判断是否为平局

public class Text1 {
    public static boolean checkoblique(int[][] board,int num)
    {
        int c= 0,d=0;
        for(int i = 0,k = board.length-1;i<board.length;i++,k--)
        {
            if(board[i][i] != num)
            {
                c = 1;
            }
            if(board[k][k]!=num)
            {
                d=1;
            }
        }
        return c==0||d==0;
    }
    public static boolean checkvertical(int[][] board,int num)
    {

        for(int i=0;i<board[0].length;i++)
        {
            int n1=0;
            for(int k=0;k<board.length;k++)
            {
                if(board[k][i]!=num)
                {
                    n1=1;
                    break;
                }
            }
            if(n1==0) {
                return true;
            }
        }
        return false;
    }

    //横排
    public static boolean checkhorizontal(int[][] board,int num)
    {
        for(int i=0;i<board.length;i++)
        {
            int n=0;
            for(int k=0;k<board[i].length;k++)
            {
                if(board[i][k]!=num)
                {
                    n=1;
                    break;
                }
            }
            if(n==0)
            {
                return true;
            }
        }
        return false;
    }

    public static boolean checkWon(int[][] board) {

        return checkhorizontal(board,1)||checkhorizontal(board,-1)||checkvertical(board,1)||checkvertical(board,-1)||checkoblique(board,1)||checkoblique(board,-1);
    }

    public static void main(String[] args) {
        int[][] array={{-1,1,0},{1,1,1},{0,1,-1}};
        System.out.println(checkWon(array));
       /* System.out.println((int)'a'+" "+(int)'z'+" "+(int)'A'+" "+(int)'Z');
        System.out.println((int)'0'+" "+(int)'9');*/
    }
}
